﻿<%@ Page Title="" Language="C#" MasterPageFile="~/admin/admin.Master" AutoEventWireup="true" CodeBehind="ManageProducts.aspx.cs" Inherits="spk_eAuction.admin.ManageProducts" enableViewStateMac="false" viewStateEncryptionMode="Never" enableEventValidation="false" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit.HTMLEditor"
    TagPrefix="cc1" %>

<%@ Register assembly="FredCK.FCKeditorV2" namespace="FredCK.FCKeditorV2" tagprefix="FCKeditorV2" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <title> Quản trị - Quản lý sản phẩm</title>
    </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphBody" runat="server">
    <center>
    <asp:MultiView ID="MultiView1" runat="server">
        <asp:View ID="View1" runat="server">
            <div class="fullwidth" >
                <div class="content-head" > Danh sách sản phẩm</div>
                <div class="content-body" > 
                    <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
                        DataKeyNames="ProductID" DataSourceID="SqlDataSource1" AllowPaging="True" 
                        OnRowDataBound="GridView1_RowDataBound" CellPadding="4" ForeColor="#333333" 
                        GridLines="None" ShowFooter="True">
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <Columns>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:ImageButton ID="BtnDetails" runat="server" Height="20px" 
                                        ImageUrl="~/images/items/detail.jpg" 
                                        PostBackUrl='<%# Eval("ProductID", "~/Admin/ManageProducts.aspx?cmd=view&pid={0}")%>' Width="20px" />
                                    <asp:ImageButton ID="BtnEdit" runat="server" Height="20px" 
                                        ImageUrl="~/images/items/edit.jpg" 
                                        PostBackUrl='<%# Eval("ProductID", "~/Admin/ManageProducts.aspx?cmd=edit&pid={0}")%>' Width="20px" />
                                    <asp:ImageButton ID="BtnDelete" runat="server" CausesValidation="False" 
                                        CommandName="Delete" Height="20px" ImageUrl="~/images/items/delete.jpg" 
                                        onclientclick="return confirm('Bạn có chắc là muốn xoá?');" 
                                        Width="20px" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Mã sản phẩm" InsertVisible="False" 
                                SortExpression="ProductID">
                                <ItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("ProductID") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="Label1" runat="server" Text='<%# Eval("ProductID") %>'></asp:Label>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Tên sản phẩm" SortExpression="ProductName">
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" Text='<%# Bind("ProductName") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("ProductName") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Danh mục" SortExpression="CategoryID">
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("CategoryID") %>'></asp:TextBox>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:DropDownList ID="DropDownList2" runat="server" 
                                        DataSourceID="SqlDataSourceDropDownList" DataTextField="CategoryName" 
                                        DataValueField="CategoryID" Enabled="False" 
                                        SelectedValue='<%# Eval("CategoryID") %>'>
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SqlDataSourceDropDownList" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                                        SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Category]">
                                    </asp:SqlDataSource>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Giá thị trường" SortExpression="RetailPrice">
                                <ItemTemplate>
                                    <asp:Label ID="Label4" runat="server" Text='<%# Bind("RetailPrice", "{0:N0} đ") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("RetailPrice") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Ảnh nhỏ" SortExpression="ThumbnailUrl">
                                <ItemTemplate>
                                    <asp:Image ID="Image3" runat="server" Height="70px" Width="70px" 
                                        ImageUrl='<%# Eval("ThumbnailUrl") %>' />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox4" runat="server" Text='<%# Bind("ThumbnailUrl") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Người đăng" SortExpression="PostUser">
                                <ItemTemplate>
                                    <asp:DropDownList ID="DropDownList3" runat="server" 
                                        DataSourceID="SqlDataSource5" DataTextField="UserName" DataValueField="UserId" 
                                        Enabled="False" SelectedValue='<%# Eval("PostUser") %>'>
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SqlDataSource5" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                                        SelectCommand="SELECT [UserId], [UserName] FROM [vw_aspnet_Users]">
                                    </asp:SqlDataSource>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox5" runat="server" Text='<%# Bind("PostUser") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Chi tiết" SortExpression="Details">
                                <ItemTemplate>
                                    <asp:Label ID="Label7" runat="server" Text='<%# Bind("Details") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox6" runat="server" Text='<%# Bind("Details") %>'></asp:TextBox>
                                </EditItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                        <EditRowStyle BackColor="#999999" />
                        <EmptyDataTemplate>
                            Không có sản phẩm để hiển thị
                        </EmptyDataTemplate>
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#E9E7E2" />
                        <SortedAscendingHeaderStyle BackColor="#506C8C" />
                        <SortedDescendingCellStyle BackColor="#FFFDF8" />
                        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
                    </asp:GridView> 
                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                        SelectCommand="SELECT * FROM [Products]" 
                        ConflictDetection="CompareAllValues" 
                        DeleteCommand="DELETE FROM [Products] WHERE [ProductID] = @original_ProductID AND (([SimilarProduct] = @original_SimilarProduct) OR ([SimilarProduct] IS NULL AND @original_SimilarProduct IS NULL)) AND (([RetailPrice] = @original_RetailPrice) OR ([RetailPrice] IS NULL AND @original_RetailPrice IS NULL)) AND (([ThumbnailUrl] = @original_ThumbnailUrl) OR ([ThumbnailUrl] IS NULL AND @original_ThumbnailUrl IS NULL)) AND (([ImageUrl] = @original_ImageUrl) OR ([ImageUrl] IS NULL AND @original_ImageUrl IS NULL)) AND (([CategoryID] = @original_CategoryID) OR ([CategoryID] IS NULL AND @original_CategoryID IS NULL)) AND (([PostUser] = @original_PostUser) OR ([PostUser] IS NULL AND @original_PostUser IS NULL)) AND (([ProductName] = @original_ProductName) OR ([ProductName] IS NULL AND @original_ProductName IS NULL)) AND (([Details] = @original_Details) OR ([Details] IS NULL AND @original_Details IS NULL))" 
                        InsertCommand="INSERT INTO [Products] ([SimilarProduct], [RetailPrice], [ThumbnailUrl], [ImageUrl], [CategoryID], [PostUser], [ProductName], [Details]) VALUES (@SimilarProduct, @RetailPrice, @ThumbnailUrl, @ImageUrl, @CategoryID, @PostUser, @ProductName, @Details)" 
                        OldValuesParameterFormatString="original_{0}" 
                        UpdateCommand="UPDATE [Products] SET [SimilarProduct] = @SimilarProduct, [RetailPrice] = @RetailPrice, [ThumbnailUrl] = @ThumbnailUrl, [ImageUrl] = @ImageUrl, [CategoryID] = @CategoryID, [PostUser] = @PostUser, [ProductName] = @ProductName, [Details] = @Details WHERE [ProductID] = @original_ProductID AND (([SimilarProduct] = @original_SimilarProduct) OR ([SimilarProduct] IS NULL AND @original_SimilarProduct IS NULL)) AND (([RetailPrice] = @original_RetailPrice) OR ([RetailPrice] IS NULL AND @original_RetailPrice IS NULL)) AND (([ThumbnailUrl] = @original_ThumbnailUrl) OR ([ThumbnailUrl] IS NULL AND @original_ThumbnailUrl IS NULL)) AND (([ImageUrl] = @original_ImageUrl) OR ([ImageUrl] IS NULL AND @original_ImageUrl IS NULL)) AND (([CategoryID] = @original_CategoryID) OR ([CategoryID] IS NULL AND @original_CategoryID IS NULL)) AND (([PostUser] = @original_PostUser) OR ([PostUser] IS NULL AND @original_PostUser IS NULL)) AND (([ProductName] = @original_ProductName) OR ([ProductName] IS NULL AND @original_ProductName IS NULL)) AND (([Details] = @original_Details) OR ([Details] IS NULL AND @original_Details IS NULL))">
                        <DeleteParameters>
                            <asp:Parameter Name="original_ProductID" Type="Int32" />
                            <asp:Parameter Name="original_SimilarProduct" Type="Int32" />
                            <asp:Parameter Name="original_RetailPrice" Type="Double" />
                            <asp:Parameter Name="original_ThumbnailUrl" Type="String" />
                            <asp:Parameter Name="original_ImageUrl" Type="String" />
                            <asp:Parameter Name="original_CategoryID" Type="Int32" />
                            <asp:Parameter Name="original_PostUser" Type="Object" />
                            <asp:Parameter Name="original_ProductName" Type="String" />
                            <asp:Parameter Name="original_Details" Type="String" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="SimilarProduct" Type="Int32" />
                            <asp:Parameter Name="RetailPrice" Type="Double" />
                            <asp:Parameter Name="ThumbnailUrl" Type="String" />
                            <asp:Parameter Name="ImageUrl" Type="String" />
                            <asp:Parameter Name="CategoryID" Type="Int32" />
                            <asp:Parameter Name="PostUser" Type="Object" />
                            <asp:Parameter Name="ProductName" Type="String" />
                            <asp:Parameter Name="Details" Type="String" />
                        </InsertParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="SimilarProduct" Type="Int32" />
                            <asp:Parameter Name="RetailPrice" Type="Double" />
                            <asp:Parameter Name="ThumbnailUrl" Type="String" />
                            <asp:Parameter Name="ImageUrl" Type="String" />
                            <asp:Parameter Name="CategoryID" Type="Int32" />
                            <asp:Parameter Name="PostUser" Type="Object" />
                            <asp:Parameter Name="ProductName" Type="String" />
                            <asp:Parameter Name="Details" Type="String" />
                            <asp:Parameter Name="original_ProductID" Type="Int32" />
                            <asp:Parameter Name="original_SimilarProduct" Type="Int32" />
                            <asp:Parameter Name="original_RetailPrice" Type="Double" />
                            <asp:Parameter Name="original_ThumbnailUrl" Type="String" />
                            <asp:Parameter Name="original_ImageUrl" Type="String" />
                            <asp:Parameter Name="original_CategoryID" Type="Int32" />
                            <asp:Parameter Name="original_PostUser" Type="Object" />
                            <asp:Parameter Name="original_ProductName" Type="String" />
                            <asp:Parameter Name="original_Details" Type="String" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                </div>
                <div class="content-foot" > 
                    <asp:HyperLink ID="HyperLink1" runat="server" 
                        NavigateUrl="~/admin/ManageProducts.aspx?cmd=insert">Thêm sản phẩm</asp:HyperLink>
                </div>
            </div>
        </asp:View>
        <asp:View ID="View2" runat="server">
            <div class="fullwidth" >
                <div class="content-head" >
                    <asp:Label ID="LableView2Head" runat="server" Text="Label"></asp:Label> </div>
                <div class="content-body" > 
                    <asp:SqlDataSource ID="SqlDataSource6" runat="server" 
                        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                        DeleteCommand="DELETE FROM [Products] WHERE [ProductID] = @ProductID" 
                        InsertCommand="INSERT INTO [Products] ([SimilarProduct], [RetailPrice], [ThumbnailUrl], [ImageUrl], [CategoryID], [PostUser], [ProductName], [Details]) VALUES (@SimilarProduct, @RetailPrice, @ThumbnailUrl, @ImageUrl, @CategoryID, @PostUser, @ProductName, @Details)" 
                        SelectCommand="SELECT * FROM [Products] WHERE ([ProductID] = @ProductID)" 
                        UpdateCommand="UPDATE [Products] SET [SimilarProduct] = @SimilarProduct, [RetailPrice] = @RetailPrice, [ThumbnailUrl] = @ThumbnailUrl, [ImageUrl] = @ImageUrl, [CategoryID] = @CategoryID, [PostUser] = @PostUser, [ProductName] = @ProductName, [Details] = @Details WHERE [ProductID] = @ProductID">
                        <DeleteParameters>
                            <asp:Parameter Name="ProductID" Type="Int32" />
                        </DeleteParameters>
                        <InsertParameters>
                            <asp:Parameter Name="SimilarProduct" Type="Int32" />
                            <asp:Parameter Name="RetailPrice" Type="Double" />
                            <asp:Parameter Name="ThumbnailUrl" Type="String" />
                            <asp:Parameter Name="ImageUrl" Type="String" />
                            <asp:Parameter Name="CategoryID" Type="Int32" />
                            <asp:Parameter Name="PostUser" DbType="Guid" />
                            <asp:Parameter Name="ProductName" Type="String" />
                            <asp:Parameter Name="Details" Type="String" />
                        </InsertParameters>
                        <SelectParameters>
                            <asp:QueryStringParameter Name="ProductID" QueryStringField="pid" 
                                Type="Int32" />
                        </SelectParameters>
                        <UpdateParameters>
                            <asp:Parameter Name="SimilarProduct" Type="Int32" />
                            <asp:Parameter Name="RetailPrice" Type="Double" />
                            <asp:Parameter Name="ThumbnailUrl" Type="String" />
                            <asp:Parameter Name="ImageUrl" Type="String" />
                            <asp:Parameter Name="CategoryID" Type="Int32" />
                            <asp:Parameter Name="PostUser" DbType="Guid" />
                            <asp:Parameter Name="ProductName" Type="String" />
                            <asp:Parameter Name="Details" Type="String" />
                            <asp:Parameter Name="ProductID" Type="Int32" />
                        </UpdateParameters>
                    </asp:SqlDataSource>
                    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" 
                        DataKeyNames="ProductID" DataSourceID="SqlDataSource6" CellPadding="4" 
                        ForeColor="#333333" GridLines="None" DefaultMode="Insert">
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                        <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
                        <EditRowStyle BackColor="#999999" />
                        <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
                        <Fields>
                            <%-- ProductID - Label3 --%>
                            <%-- ThumbnailUrl - Image1 --%>
                            <%-- ImageUrl - Image2 --%>
                            <%-- RetailPrice - TextBox3--%>
                            <%-- PostUser - LblUser --%>
                            <%-- CategoryID - DropDownList1 --%>
                            <%-- Các thuộc tính theo từng ngôn ngữ --%>
                            <%-- Hết các thuộc tính theo từng ngôn ngữ --%>
                            <asp:TemplateField HeaderText="Mã sản phẩm" InsertVisible="False" 
                                SortExpression="ProductID">
                                <ItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("ProductID") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="Label3" runat="server" Text='<%# Bind("ProductID") %>'></asp:Label>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:HiddenField ID="HiddenField2" runat="server" 
                                        Value='<%# Bind("ProductID") %>' />
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Tên sản phẩm">
                                <ItemTemplate>
                                    <asp:Label ID="Label8" runat="server" Text='<%# Bind("ProductName") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("ProductName") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                        ControlToValidate="TextBox7" ErrorMessage="*" SetFocusOnError="True">Trường bắt buộc</asp:RequiredFieldValidator>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox7" runat="server" Text='<%# Bind("ProductName") %>'></asp:TextBox>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" 
                                        ControlToValidate="TextBox7" ErrorMessage="*" SetFocusOnError="True">Trường bắt buộc</asp:RequiredFieldValidator>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Loại sản phẩm" SortExpression="CategoryName">
                                <EditItemTemplate>
                                    <asp:DropDownList ID="DropDownList1" runat="server" 
                                        DataSourceID="SqlDataSourceCategory" DataTextField="CategoryName" 
                                        DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SqlDataSourceCategory" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                                        SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Category]">
                                    </asp:SqlDataSource>
                                </EditItemTemplate>
                                <ItemTemplate>
                                    <asp:DropDownList ID="DropDownList1" runat="server" 
                                        DataSourceID="SqlDataSourceCategory" DataTextField="CategoryName" 
                                        DataValueField="CategoryID" Enabled="False" 
                                        SelectedValue='<%# Bind("CategoryID") %>'>
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SqlDataSourceCategory" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                                        SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Category]">
                                    </asp:SqlDataSource>
                                </ItemTemplate>
                                <InsertItemTemplate>
                                    <asp:DropDownList ID="DropDownList1" runat="server" 
                                        DataSourceID="SqlDataSourceCategory" DataTextField="CategoryName" 
                                        DataValueField="CategoryID" SelectedValue='<%# Bind("CategoryID") %>'>
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SqlDataSourceCategory" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                                        SelectCommand="SELECT [CategoryID], [CategoryName] FROM [Category]">
                                    </asp:SqlDataSource>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Giá thị trường" SortExpression="RetailPrice">
                                <ItemTemplate>
                                    <asp:Label ID="Label2" runat="server" 
                                        Text='<%# Eval("RetailPrice", " {0:N0} Đ") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("RetailPrice") %>'></asp:TextBox>
                                    <asp:CompareValidator ID="CompareValidator1" runat="server" 
                                        ControlToValidate="TextBox3" ErrorMessage="Số tiền là nguyên và lớn hơn 1000đ" 
                                        Operator="GreaterThan" SetFocusOnError="True" Type="Integer" 
                                        ValueToCompare="1000">*</asp:CompareValidator>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                        ControlToValidate="TextBox3" ErrorMessage="Trường bắt buộc" 
                                        SetFocusOnError="True">*</asp:RequiredFieldValidator>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("RetailPrice") %>'></asp:TextBox>
                                    <asp:CompareValidator ID="CompareValidator1" runat="server" 
                                        ControlToValidate="TextBox3" ErrorMessage="Số tiền là nguyên và lớn hơn 1000đ" 
                                        Operator="GreaterThan" SetFocusOnError="True" Type="Integer" 
                                        ValueToCompare="1000">*</asp:CompareValidator>
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
                                        ControlToValidate="TextBox3" ErrorMessage="Trường bắt buộc" 
                                        SetFocusOnError="True">*</asp:RequiredFieldValidator>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Người đăng" SortExpression="PostUser">
                                <ItemTemplate>
                                    <asp:DropDownList ID="DropDownList4" runat="server" 
                                        DataSourceID="SqlDataSource1" DataTextField="UserName" DataValueField="UserId" 
                                        SelectedValue='<%# Bind("PostUser") %>' Enabled="False">
                                    </asp:DropDownList>
                                    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
                                        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
                                        SelectCommand="SELECT [UserId], [UserName] FROM [vw_aspnet_Users]">
                                    </asp:SqlDataSource>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Label ID="LblUser" runat="server" Text='<%# Bind("PostUser") %>' 
                                        Visible="False"></asp:Label>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:Label ID="LblUser" runat="server" Text='<%# Bind("PostUser") %>' 
                                        Visible="False"></asp:Label>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Ảnh nhỏ">
                                <ItemTemplate>
                                    <asp:Image ID="Image1" runat="server" Height="100px" 
                                        ImageUrl='<%# Eval("ThumbnailUrl") %>' Width="100px" />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Image ID="Image1" runat="server" Height="100px" 
                                        ImageUrl='<%# Bind("ThumbnailUrl") %>' Width="100px" />
                                    <br />
                                    <asp:FileUpload ID="FileUpload1" runat="server" />
                                    <br />
                                    <asp:Button ID="BtnUpload1" runat="server" CausesValidation="False" 
                                        onclick="BtnUpload1_Click" Text="Nạp hình" />
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:Image ID="Image1" runat="server" Height="100px" 
                                        ImageUrl='<%# Bind("ThumbnailUrl") %>' Width="100px" />
                                    <br />
                                    <asp:FileUpload ID="FileUpload1" runat="server" Visible="False" />
                                    <br />
                                    <asp:Button ID="BtnUpload1" runat="server" CausesValidation="False" 
                                        onclick="BtnUpload1_Click" Text="Nạp hình" Visible="False" />
                                    <asp:TextBox ID="TextBox8" runat="server"></asp:TextBox>
                                    <asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="False" 
                                        onclick="LinkButton3_Click">Nạp hình</asp:LinkButton>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Ảnh lớn">
                                <ItemTemplate>
                                    <asp:Image ID="Image2" runat="server" Height="200px" 
                                        ImageUrl='<%# Eval("ImageUrl") %>' Width="200px" />
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:Image ID="Image2" runat="server" Height="200px" 
                                        ImageUrl='<%# Bind("ImageUrl") %>' Width="200px" />
                                    <br />
                                    <asp:FileUpload ID="FileUpload2" runat="server" />
                                    <br />
                                    <asp:Button ID="BtnUpload2" runat="server" CausesValidation="False" 
                                        onclick="BtnUpload2_Click" Text="Nạp hình" />
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:Image ID="Image2" runat="server" Height="200px" 
                                        ImageUrl='<%# Bind("ImageUrl") %>' Width="200px" />
                                    <br />
                                    <asp:FileUpload ID="FileUpload2" runat="server" Visible="False" />
                                    <br />
                                    <asp:Button ID="BtnUpload2" runat="server" CausesValidation="False" 
                                        onclick="BtnUpload2_Click" Text="Nạp hình" Visible="False" />
                                    <asp:TextBox ID="TextBox9" runat="server"></asp:TextBox>
                                    <asp:LinkButton ID="LinkButton4" runat="server" CausesValidation="False" 
                                        onclick="LinkButton4_Click">Nạp hình</asp:LinkButton>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Chi tiết">
                                <ItemTemplate>
                                    <asp:Label ID="Label9" runat="server" Text='<%# Eval("Details") %>'></asp:Label>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <cc1:Editor ID="Editor1" runat="server" Content='<%# Bind("Details") %>' 
                                        Height="300px" Width="500px" />
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <cc1:Editor ID="Editor1" runat="server" Content='<%# Bind("Details") %>' 
                                        Height="300px" Width="500px" />
                                </InsertItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField>
                                <ItemTemplate>
                                    <asp:LinkButton ID="LinkButton1" runat="server" 
                                        PostBackUrl="~/admin/ManageProducts.aspx?cmd=insert">Thêm sản phẩm</asp:LinkButton>
                                    <asp:LinkButton ID="LinkButton2" runat="server" 
                                        PostBackUrl='<%#Eval("ProductID", "~/admin/ManageProducts.aspx?cmd=edit&pid={0}")%>'>Sửa sản phẩm</asp:LinkButton>
                                </ItemTemplate>
                                <EditItemTemplate>
                                    <asp:LinkButton ID="LinkButtonUpdate" runat="server" CommandName="Update" 
                                        PostBackUrl="~/admin/ManageProducts.aspx">Cập nhật</asp:LinkButton>
                                    <asp:LinkButton ID="LinkButtonCancelUpdate" runat="server" CommandName="Cancel" 
                                        PostBackUrl="~/admin/ManageProducts.aspx" CausesValidation="False">Huỷ</asp:LinkButton>
                                </EditItemTemplate>
                                <InsertItemTemplate>
                                    <asp:LinkButton ID="LinkButtonInsert" runat="server" CommandName="Insert" 
                                        PostBackUrl="~/admin/ManageProducts.aspx">Thêm</asp:LinkButton>
                                    <asp:LinkButton ID="LinkButtonCancelInsert" runat="server" CommandName="Cancel" 
                                        PostBackUrl="~/admin/ManageProducts.aspx" CausesValidation="False">Huỷ</asp:LinkButton>
                                </InsertItemTemplate>
                            </asp:TemplateField>
                        </Fields>
                        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    </asp:DetailsView>
                </div>
                  
                <div class="content-foot" > 
                    <asp:HyperLink ID="HyperLink2" runat="server" 
                        NavigateUrl="~/admin/ManageProducts.aspx">Về danh sách sản phẩm</asp:HyperLink>
                </div>
            </div>
        </asp:View>
    </asp:MultiView>
    </center>
</asp:Content>
